/**
 *  A little instance to wrap an R Engine
 *
 *  Copyright (c) 2009 Daniel Kornhauser.  All rights reserved.
 *  @author Daniel Kornhauser
 */



import java.util.Vector;

import javax.swing.JPanel;

import org.rosuda.JRI.REXP;
import org.rosuda.JRI.RVector;
import org.rosuda.JRI.Rengine;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author dkor
 */
public class R {

    public Rengine engine;
    //Vector names  = new Vector();

	public R(SweepViewGui sweepViewGui) 
	{
        String[] dummyArgs = new String[1];
        dummyArgs[0] = "--vanilla";
        engine = new Rengine(dummyArgs, true, new TextConsole(sweepViewGui));
	}

    public void initR()
    {
    	engine.eval("source('callbacks.R')	");
    	engine.eval("Sys.setenv('JAVAGD_CLASS_NAME'='GD')");
    	engine.eval("init_r()");
    }

    private void loadCSV(String csvArgument)
    {
        //REXP rn = engine.eval(csvArgument);
    	//REXP x;
    	//x=engine.eval("data");
    	// generic vectors are RVector to accomodate names
    	//RVector v = x.asVector();
    	//names = v.getNames();
    }
}


